<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height border-hover-style outline-style2">
    <t-popup
      class="placement bottom center"
      attach="#attach"
      content="查看本单元全景展厅"
      placement="bottom"
      showArrow
      destroyOnClose
      :disabled="store.isMobileType ? true : false"
    >
      <img
        v-if="props.info.digitalShowroom"
        class="icon-3d blinking-animation-style"
        id="outlineIcon"
        @click="open(props.info.digitalShowroom)"
        :src="publicUrls + 'free/style4/3dIcon.png'"
      />
    </t-popup>
    <div class="outline-parent-bg">
      <img v-if="props.info.remarks" :src="publicUrls + 'free/style4/Level1outlineStyle3Bg.webp'" alt="" />
      <img v-else :src="publicUrls + 'free/style4/Level1outlineStyle3Bg2.webp'" alt="" />
      <img v-if="props.info.remarks" :src="publicUrls + 'free/style4/Level1outlineStyle3Line.webp'" alt="" />
      <img v-else :src="publicUrls + 'free/style4/Level1outlineStyle3Line2.webp'" alt="" />
      <div class="cover" :class="!props.info.remarks && 'cover2'">
        <img
          class="outline-cover"
          v-if="props.info.value"
          :src="urls + props.info.value + '?imageView2/3/format/webp'"
          alt=""
        />
        <img
          v-else-if="props.info.remarks"
          class="outline-cover-null"
          :src="publicUrls + 'free/style4/Level1outlineStyle3Round.webp'"
          alt=""
        />
        <img
          v-else
          class="outline-cover-null2"
          :src="publicUrls + 'free/style4/Level1outlineStyle3Round2.webp'"
          alt=""
        />
      </div>
    </div>
    <div class="outline jy-style-height">
      <div class="outline-content" :class="!props.info.remarks && 'outline-content2'">
        <div
          class="imgclick"
          :class="!props.info.remarks && 'imgclick2'"
          v-if="props.info.value"
          @click="ImgVisible = true"
        ></div>
        <div class="content-tiitle" :class="!props.info.remarks && props.info.text?.length > 4 && 'content-tiitle2'">
          <p :class="props.info.text?.length > 4 && 'titleMargin'">{{ props.info.text }}</p>
          <div class="titlebg">
            <div class="imgBox"></div>
            <div class="line line1"></div>
            <div class="imgBox"></div>
          </div>
        </div>
        <p class="outline-subTitle" :class="!props.info.remarks && 'outline-subTitle2'" v-if="props.info.subTitle">
          ——{{ props.info.subTitle }}
        </p>
        <TextMax :data="props.info.remarks" :infoData="props.info" :title="props.info.text" :row="14"></TextMax>
      </div>
    </div>
    <img class="shadow" :src="publicUrls + 'free/style4/firstLevelOutline1Shadow.png?imageView2/3/format/webp'" alt="" />
  </div>
</template> 

<script lang="ts">
export default defineComponent({
  name: 'free4Style2',
});
</script>

<script setup lang="ts">
import { publicUrls, textType } from '@/utils/minxin';
import { getTextHtml } from '@/utils/minxin';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { useProjectStore } from '@/store';

const ImgVisible = ref(false);
const store = useProjectStore();

const props = defineProps({
  info: {
    type: Object,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style scoped lang="less">
.outline-parent {
  position: relative;
  margin-right: 90px;
  margin-top: 0;
  margin-left: 120px;
  .shadow {
    width: 820px;
    height: 254px;
    position: absolute;
    bottom: 0;
    left: 50px;
  }
  .icon-3d {
    width: 37px;
    height: 47px;
    object-fit: contain;
    position: absolute;
    top: -6px;
    left: 50px;
    z-index: 21;
  }
}
.outline-parent-bg {
  width: 654px;
  height: 100%;
  position: relative;
  z-index: 20;
  display: flex;
  overflow: hidden;
  img:first-child {
    width: 100%;
    height: 100%;
  }
  img:last-child {
    width: 18px;
    height: 100%;
  }
  .cover2 {
    width: 295px !important;
    height: 590px !important;
    margin-bottom: 0 !important;
    top: 78% !important;
    transform: translate(0, -78%) !important;
    .outline-cover {
      object-position: center !important;
    }
    .outline-cover-null2 {
      object-fit: contain !important;
    }
  }
  .cover {
    display: flex;
    align-items: center;
    width: 480px;
    height: 480px;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translate(0, -50%);
    overflow: hidden;
    z-index: -1;
    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: left;
    }
    .outline-cover-null {
      width: 100%;
      height: 100%;
      object-fit: contain;
      object-position: right;
    }
  }
}
.outline {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  padding: 142px 0 142px 0;
}
.outline-content2 {
  padding-left: 95px !important;
}
.outline-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: start;
  padding-left: 45px;
  .imgclick {
    width: 240px;
    height: 430px;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translate(0, -50%);
  }
  .imgclick2 {
    width: 320px !important;
    height: 530px !important;
    top: 72%;
    transform: translate(0, -72%);
  }
  .content-tiitle2 {
    width: 286px;
    ::v-deep p {
      text-align: center;
    }
    .line {
      background: url(https://static.jiyi.show/free/style4/cenImgh.png) no-repeat !important;
      background-size: 100% 100% !important;
    }
    .imgBox {
      width: 80px !important;
      &:first-child {
        background: url(https://static.jiyi.show/free/style4/leftImgh.png) no-repeat !important;
        background-size: 100% 100% !important;
      }
      &:last-child {
        background: url(https://static.jiyi.show/free/style4/rightImgh.png) no-repeat !important;
        background-size: 100% 100% !important;
      }
    }
  }
  .content-tiitle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 36px;
    position: relative;
    .titleMargin {
      margin: 5px 7px !important;
    }
    ::v-deep p {
      color: #5391a3;
      font-family: 'SourceHanSerifCN-Bold';
      font-size: 24px;
      line-height: 36px;
      margin: 5px 15px;
    }
    .titlebg {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      img {
        width: 100%;
        height: 16px;
      }
      .line {
        width: 100%;
        height: 100%;
        background: url(https://static.jiyi.show/free/style4/cenImg.png) no-repeat;
        background-size: 100% 100%;
      }
      .imgBox {
        width: 48px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        flex-shrink: 0;
        &:first-child {
          background: url(https://static.jiyi.show/free/style4/leftImg.png) no-repeat;
          background-size: 100% 100%;
        }
        &:last-child {
          background: url(https://static.jiyi.show/free/style4/rightImg.png) no-repeat;
          background-size: 100% 100%;
        }
      }
    }
  }
  .outline-subTitle2 {
    width: 283px !important;
  }
  .outline-subTitle {
    width: 400px;
    color: #333;
    text-align: left;
    font-family: 'SourceHanSerifCN';
    font-size: 18px;
    line-height: 28px;
    margin-bottom: 32px;
  }
}

::v-deep .textMore-box {
  width: 300px;
}
::v-deep .van-text-ellipsis {
  font-family: PingFangSC !important;
  font-size: 16px !important;
  color: #333 !important;
  line-height: 32px !important;
}
::v-deep .van-text-ellipsis__action::before {
  color: #83b0b3 !important;
  font-weight: 400 !important;
  text-decoration-line: underline;
}
::v-deep .t-popup__content {
  background: #bcd5d5;
  box-shadow: none;
  padding: 0 10px;
  line-height: 20px;
  color: #fcffff;
}
::v-deep .t-popup__arrow::before {
  background: #bcd5d5;
  border: none;
  box-shadow: none !important;
}
</style>